﻿using System.ServiceModel;
using System.ServiceModel.Web;
using CoreLibrary.Paging;
using CoreLibrary.Service;
using Entities.DataBase.Obj;
using WebService.Service.Transfer;

namespace WebService.Service {

    [ServiceContract]
    public interface ICustomerServiceX {

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat  = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/AddCustomer")]
        string AddCustomer(string passport, AddCustomerRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/UpdateCustomer")]
        bool UpdateCustomer(string passport, UpdateCustomerRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/RemoveCustomer")]
        bool RemoveCustomer(string passport, string customerId);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/ListCustomers")]
        PagingResult<CustomerInfo> ListCustomers(string passport, PagingRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat    = WebMessageFormat.Json,
            ResponseFormat   = WebMessageFormat.Json,
            UriTemplate      = "/SearchCustomers")]
        JSONSearchResult<CustomerInfo> SearchCustomers(string passport, JSONSearchRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/SendPurchaseRequest")]
        bool SendPurchaseRequest(string passport, CreatePurchaseListRequest request);

    }
}
